//
// Created by ASUS on 2024/5/20/星期一.
//
#include <bits/stdc++.h>
using namespace std;


// 满足元音出现偶数次的最长字符串长度
int findTheLongestSubstring(string s) {
	int n = s.length();
	unordered_map<char, int> mp{
			{'a', 0}, {'e', 1}, {'i', 2}, {'o', 3}, {'u', 4}};
	vector<int> pos(1 << 5, n);
	pos[0] = -1;//至关重要
	int ans = 0, pre = 0;
	for (int i = 0; i < n; i++) {
		if (mp.contains(s[i]))
			pre ^= (1 << mp[s[i]]);
		ans = max(ans, i - pos[pre]);
		if (pos[pre] == n)
			pos[pre] = i;
	}
	return ans;
}

//满足随意交换是回文串的非空最长字符串长度，字符集为0-9
int longestAwesome(string s) {
	int n = s.length();
	vector<int> pos(1 << 10, n);
	pos[0] = -1;
	int ans = 0, pre = 0;
	for (int i = 0; i < n; i++) {
		pre ^= 1 << (s[i] - '0');
		for (int d = 0; d < 10; d++) {
			ans = max(ans, i - pos[pre ^ (1 << d)]);
		}
		ans = max(ans, i - pos[pre]);
		if (pos[pre] == n) {
			pos[pre] = i;
		}
	}
	return ans;
}